﻿//逻辑代码
import {Puerts, UnityEngine} from 'csharp'
import {$typeof} from 'puerts'
import PuertsActionTask = Puerts.PuertsActionTask;
/*
    optional override
   * OnInit()
   * OnUpdate()
   * OnExecute()
   * OnStop()
    * */
export class PuertsAction
{
    protected task : PuertsActionTask;
    constructor(actionTask:PuertsActionTask) {
        this.task = actionTask
        if ('OnInit' in this) // @ts-ignore
            actionTask._OnInit = () => this.OnInit();
        if ('OnUpdate' in this) // @ts-ignore
            actionTask._OnUpdate = (t) => this.OnUpdate(t);
        if ('OnStop' in this) // @ts-ignore
            actionTask._OnStop = () => this.OnStop();
        if ('OnExecute' in this)//@ts-ignore
            actionTask._OnExecute = () => this.OnExecute();
    }
    EndAction(success:boolean){
        this.task.EndAction(success)
    }
    // onInit(){}
    // onUpdate(){}
    // onStop(){}
}
